﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yncTech.Common
{
    public class Resource
    {
        #region GetImage
        public static string GetImage(string imageName)
        {
            return ApplicationState.AbsoluteUri + "App_Themes/default/images/" + imageName;
        }
        public static string GetImage(string theme, string imageName)
        {

            return ApplicationState.AbsoluteUri + string.Format("App_Themes/{0}/images/",theme) + imageName;
        }
        #endregion


        #region GetScript
        public static string GetScript(string scriptName)
        {
            return ApplicationState.AbsoluteFullUri + "Scripts/" + scriptName;
        }
        #endregion

        #region GetFlash
        public static string GetFlash(string fileName, int width, int height)
        {
            string path = ApplicationState.AbsoluteUri + "App_Themes/default/flash/" + fileName;
            //string s = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height +"\" id=\"RemoteInterView\" align=\"middle\">";
            string s = "<embed src='" + path + "' loop=-1 quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" border=0 width=\"" + width + "\" height=\"" + height + "\"></embed>";
            //s += "</object>";
            return s;
        }
        #endregion

        #region GetAllCss
        public static string[] GetAllCss()
        {
            string path = ApplicationState.AbsoluteUri + "App_Themes/default";
            path = System.Web.HttpContext.Current.Server.MapPath(path);
            string[] files = System.IO.Directory.GetFiles(path, "*.css");
            for (int i = 0; i < files.Length; i++)
            {
                files[i] = System.IO.Path.GetFileName(files[i]);
            }
            return files;
        }
        #endregion
    }
}
